﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;
using PdfSharp;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
using PdfSharp.Drawing;
using PdfSharp.Drawing.Layout;

namespace RKMSikraKulingram.PDFUtil
{
    internal class TestPDFMaker
    {
        internal static void SaveTestPDF()
        {
            const string filename = "TestPDF.pdf";

            const PageSize pageSize = PageSize.A4;

            const string text1 =
              @"Children of Bodom was formed in 1993 by guitarist Alexi ""Wildchild"" Laiho and drummer Jaska Raatikainen under the name of Inearthed. Both musicians had known each other since early childhood and had shared an interest in heavy metal, especially death metal groups, such as Dissection, Entombed, and Obituary. Bassist Samuli Miettinen completed the initial line-up of the band. Inearthed recorded its first demo, Implosion of Heaven, during August of the same year. Samuli was the main composer of the band's lyrics for the two years that he took part in Inearthed, but his family moved to the United States in 1995, making it impossible for him to remain in the band. His last contribution to Inearthed were the lyrics of the songs from their second demo, Ubiquitous Absence of Remission which was first time they worked with producer Anssi Kippo at Astia-studios (Lappeenranta, Finland). In this demo, keyboards were incorporated into the band's songs for the first time. In order to achieve this, both Laiho and Raatikainen played the keyboards separately, and subsequently mixed the recorded track with the other instruments. Laiho, who had previously only composed the melodies of the songs, assumed the role of the band's lyricist. At the time, Raatikainen played French horn in a local big band, and during a rehearsal he met Alexander Kuoppala, a trumpet player and also a proficient guitarist. Shortly after the recording of their second demo, Kuoppala was invited to join Inearthed as a rhythm guitarist. The bassist chosen to replace Samuli was Henkka ""Blacksmith"" Seppälä, whom Laiho and Raatikainen had previously known from school. Apart from playing the bass, Seppälä also often doubles as the band's backing vocalist. Also, the band recruited a musician to specialize on keyboards, whose name was Jani Pirisjoki. Both joined Inearthed in early 1996. With this new line-up, Inearthed proceeded to record their third demo, entitled Shining. This demo did not impress record labels any more than the previous ones had, and none took interest in the band.[9] Despite their efforts, their music got little exposure and managed only to play at local events. As a last resort, the band decided to record an independent, self-funded album. Considering that none of the musicians had much money to begin with, it was an audacious move. Laiho wanted to make use of the keyboards more effectively, though Pirisjoki was not attending rehearsals; thus, he was fired and replaced by a friend of Raatikainen's, a jazz pianist named Janne ""Warman"" Wirman. Wirman was the component which was previously missing from Inearthed. His presence allowed the band to assume the style which would later characterize Children of Bodom. With Wirman, the band successfully recorded their first album in 1997. Their debut, Something Wild, was supposed to be released by a small Belgian label, Shiver records, but second vocalist Sami Tenetz (from Thy Serpent) acquired a copy of their album through the hands of Kuoppala, both worked for the same company at the time. Shortly after Inearthed signed this contract, ";
            const string text2 =
                @" Spinefarm Records' boss immediately became interested in signing them for a country-wide release.[citation needed] The latter deal was much more attractive to the band, since the Belgian label was offering them close to no help, to the point where they would have to distribute and sell the album themselves. The band was required to create a new name to sign up to Spinefarm Records. The contract with Shiver records had already been signed under the name of Inearthed. The answer to that problem came as, members looked for good names in their local phone book. When they stumbled upon Lake Bodom, they realized that it was a name with impact and one which had an interesting story behind it. A long list of possible names involving the word Bodom was then made, and they settled with Children of Bodom. The band's name is derived from the Lake Bodom murders.Something Wild was produced, recorded and mixed by Anssi Kippo and Children of Bodom at Astia-studios (Lappeenranta, Finland). In an attempt to promote their band, they opened a show for Dimmu Borgir in 1997. Their success was such that a representative from the Nuclear Blast label shortly approached them with a contract for a European release, a deal which started on the subsequent year.[citation needed] Something Wild was officially released in November 1997, and for promotional purposes the band recorded a music video of the song ""Deadnight Warrior"". The video was directed by Mika Lindberg and had a slim budget of €1000. It made use of simple scenery, which consisted essentially of an outdoors location after a snowstorm. The band played for a couple of hours at night, with an average temperature of minus fifteen degrees Celsius.Although Laiho is very critical of all of the music he has written, he notes that he dislikes Something Wild the most of all of his albums. When recording this album, Laiho had tried to mimic the style of one of his idols, Yngwie Malmsteen, which is why Something Wild is considered one of the most technical albums Children of Bodom have ever produced.Children of Bodom's first European tour began in February 1998. They played together with bands such as Hypocrisy (at such festivals as Under the Black Sun), The Kovenant and Agathodaimon, but suffered from the absence of Wirman, who was concentrating on finishing his studies.[citation needed] He was replaced by pianist Erna Siikavirta for the duration of the tour.Months later, the band recorded two new songs again at Astia-studios with producer Anssi Kippo, entitled ""Towards Dead End"" and ""Children of Bodom"". The latter was included in a compilation by Spinefarm Records, which after being released remained on the top of Finnish charts for eight consecutive weeks.[citation needed] In late August, the band played the song ""Forevermore"" live for the first time during a show in Russia. This song was later renamed ""Downfall"". Their second European tour occurred in September of that same year, but once more Wirman was not able to perform with them. Laiho's then-girlfriend Kimberly Goss (from Sinergy and formerly of Dimmu Borgir, Ancient and Therion) assumed the keyboards this time. By the end of the tour, Kimberly invited Laiho to join Sinergy, which at the time was still in its early stages.";


            // Create a new PDF document
            PdfDocument document = new PdfDocument();

            // Create a font
            XFont font = new XFont("Calibri", 12, XFontStyle.Bold);

            // One page in Portrait...
            PdfPage page = document.AddPage();
            page.Size = pageSize;
            XGraphics gfx = XGraphics.FromPdfPage(page);
            //gfx.DrawString(PageSize.A4.ToString(), font, XBrushes.DarkRed,
            //  new XRect(0, 0, page.Width, page.Height),
            //  XStringFormats.Center);

            double columnwidth = (page.Width - 22) / 2;
            double columnHeight = (page.Height-20);
            XTextFormatter tf = new XTextFormatter(gfx);
            XRect rect = new XRect(10, 10, columnwidth, columnHeight);
            //gfx.DrawRectangle(XBrushes.White, rect);
            //tf.Alignment = XParagraphAlignment.Left;
            tf.DrawString(text1, font, XBrushes.Black, rect, XStringFormats.TopLeft);

            rect = new XRect(12 + columnwidth, 10, columnwidth, columnHeight);
            //tf.Alignment = XParagraphAlignment.Right;
            tf.DrawString(text2, font, XBrushes.Black, rect, XStringFormats.TopLeft);

            // Save the document...
            document.Save(filename);
            // ...and start a viewer.
            Process.Start(filename);
        }
    }
}
